package com.yang.system.domain.orgMng.orgType;

import com.yang.system.domain.orgMng.org.OrgStatus;

public enum OrgTypeStatus {
    DEVCENT ("devcent",1),
    DIRDEP ("direct",2),
    ENTP ("entp",3),
    EFFECTIVE("effective",4);

    private final String description; // 描述
    private final int code; // 状态码

    // 构造函数
    OrgTypeStatus(String description, int code) {
        this.description = description;
        this.code = code;
    }

    // 获取描述
    public String getDescription() {
        return description;
    }

    // 获取状态码
    public int getCode() {
        return code;
    }

    // 根据状态码获取枚举实例
    public static OrgStatus getByCode(int code) {
        for (OrgStatus status : OrgStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid status code: " + code);
    }

    @Override
    public String toString() {
        return this.description;
    }
}
